﻿<%@ Page Title="" Language="C#" MasterPageFile="~/One-Column.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="BookStore.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <title>Home Page</title>
    <style type="text/css">
        .style1
        {
            width: 156px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BreadcrumbsContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainColumnContent" runat="server">
    <div class="std">
        <div id="gallery">
            <div id="overTheImg">
                <p style="position:relative;left:-60px;font-size: 55px; line-height: 1em">
                    <strong>Light up the life</strong>
                </p>
                <p style="font-size: 35px; line-height: 1em;position:relative;left:220px;top:5px">
                    with
                </p>
                <p style="font-size: 75px; line-height: 1em;position:relative;left:100px">
                    <strong>BuyIt Store</strong>
                </p>
                <p class="a-right">
                    <a class="link-shop" href="http://staging-html.gothemeteam.com/trends.html">Shop Now</a>
                </p>
            </div>
            <div id="imgContainer">
                <ul>
                    <li><a href="./Sach.aspx">
                        <img src="./images/book-ad1.jpg" alt="" width="960" height="450" /></a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="customerFaves block">
            <div class="block-title">
                <strong>Bán Chạy Nhất</strong>
            </div>
            <div class="block-content">
                <asp:DataList ID="DataList1" runat="server" DataSourceID="dtsSach" RepeatDirection="Horizontal"
                    RepeatColumns="2">
                    <ItemTemplate>
                        <div class="home-product-image">
                            <a href="./ChiTiet.aspx">
                                <img src='<%# Eval("ImageURL") %>' alt="" height="70" /></a>
                        </div>
                        <br />
                        <h4>
                            <a href="./ChiTiet.aspx?bookid=<%# Eval("MaSach") %>"><%# Eval("TenSach") %></a>
                        </h4>
                        <span class="price">$<%# Eval("Gia") %></span>
                    </ItemTemplate>
                </asp:DataList>
            </div>
        </div>
        <div class="customerFaves block new-books">
            <div class="block-title">
                <strong>Sách mới</strong>
            </div>
            <div class="block-content">
                <asp:DataList ID="DataList2" runat="server" DataKeyField="MaSach" 
                    DataSourceID="NewBooksDS" Width="100%">
                    <ItemTemplate>
                        <div class="home-product-image">
                            <a href="./ChiTiet.aspx?bookid=<%# Eval("MaSach") %>">
                                <img src="<%# Eval("ImageURL") %>" alt="" height="70" /></a>
                        </div>
                        <br />
                        <h4>
                            <a href="./ChiTiet.aspx?bookid=<%# Eval("MaSach") %>">
                                <%# Eval("TenSach") %></a>
                        </h4>
                        <span class="price">$<%# Eval("Gia") %></span>
                    </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="NewBooksDS" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>" 
                    SelectCommand="SELECT TOP(4) [MaSach], [TenSach], LEFT(convert(varchar, cast([DonGia] as money), 1), LEN(convert(varchar, cast([DonGia] as money), 1)) - 3)  as [Gia], [ImageURL] FROM [Sach] WHERE ([SoLuong] &gt; @SoLuong) ORDER BY [NgayXuatBan] DESC, [SoLuong] DESC">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="0" Name="SoLuong" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
        </div>
        </div>
        <div class="block currentSales">
            <div class="block-title">
                <strong>Đang Giảm Giá</strong>
            </div>
            <div class="block-content">
                <ul>
                    <li><span class="left"><a href="./ChiTiet.aspx">Tuxedo Blazer</a></span><span class="right">$300.00</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Striped Hoodie</a></span><span class="right">$42.95</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Pink Dress</a></span><span class="right"><em>from</em>$99.00</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Boho Dress</a></span><span class="right">$159.00</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Yellow Sunglasses</a></span><span
                        class="right">$123.00</span> </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Striped Hoodie</a></span><span class="right">$42.95</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Pink Dress</a></span><span class="right"><em>from</em>$99.00</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Boho Dress</a></span><span class="right">$159.00</span>
                    </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Yellow Sunglasses</a></span><span
                        class="right">$123.00</span> </li>
                    <li><span class="left"><a href="./ChiTiet.aspx">Tuxedo Blazer</a></span><span class="right">$300.00</span>
                    </li>
                </ul>
            </div>
        </div>
    <asp:SqlDataSource ID="dtsSach" runat="server" ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>"
        SelectCommand="SELECT TOP (8) [Sach].[MaSach], [Sach].[TenSach], LEFT(convert(varchar, cast([DonGia] as money), 1), LEN(convert(varchar, cast([DonGia] as money), 1)) - 3)  as [Gia], [ImageURL], ctHoaDon.[SoLuong] as [soluongban] FROM [Sach] LEFT JOIN (select MaSach,sum(SoLuong) as soluong  from ChiTietHoaDon left join HoaDOn ON HoaDon.maHD=ChiTietHoaDon.maHD	where   (MONTH(HoaDon.NgayThang) = MONTH(DATEADD(month, - 1, GETDATE()))) OR (MONTH(HoaDon.NgayThang) = MONTH(GETDATE())) group by (MaSach)) as ctHoaDon  on Sach.MaSach=ctHoaDon.MaSach Where Sach.SoLuong > 0 ORDER BY ctHoaDon.SoLuong DESC, Sach.NgayXuatBan DESC">
        </asp:SqlDataSource>
</div>
</asp:Content>
